﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Teleplex.DataModels;
using System.Data.Entity.Migrations;

namespace Teleplex.Data
{
    public static class Seeder
    {
        public static void Seed(ApplicationDbContext db)
        {
            //Seed TV shows
            db.TVShows.AddOrUpdate(
                x => x.Title,
                new TVShow("New Girl", "After a bad break-up, Jess, an offbeat young woman, moves into an apartment loft with three single men. Although they find her behavior very unusual, the men support her - most of the time.", "http://broadrecognition.com/wp-content/uploads/2011/10/NewGirl_Wallpaper2_ZOOEY_1024x768.jpg"),
                new TVShow("Seinfeld", "The continuing misadventures of neurotic New York stand-up comedian Jerry Seinfeld and his equally neurotic New York friends.", "http://www.sonypictures.com/tv/seinfeld/assets/images/onesheet.jpg"),
                new TVShow("The Wonder Years", "Kevin Arnold recalls growing up during the late 60s and early 70s; the turbulent social times make the transition from child to adult unusually interesting.", "http://blogs-images.forbes.com/erikkain/files/2011/10/wonderyears1.jpg")
                );

            db.SaveChanges();
            //Seed TV Characters

            db.TVCharacters.AddOrUpdate(
                x => new { x.Name, x.Actor },
                new TVCharacter(1, "Jess", "A grade school teacher.", "Zooey Deschanel", "http://sizzlingsuperstars.com/wp-content/uploads/2014/04/Zooey-Deschanel-5.jpg"),
                new TVCharacter(1, "Nick", "A bartender.", "Jake Johnson", "http://31.media.tumblr.com/005d0b26efb831510b17fcb6b077c2cf/tumblr_miq9ogvtpv1s4hq1ko1_500.jpg"),
                new TVCharacter(2, "Jerry", "A NY City stand-up comedian.", "Jerry Seinfeld", "http://blog.kevineikenberry.com/wp-content/uploads/2013/10/seinfeld_jerry.jpg"),
                new TVCharacter(2, "Elaine", "A NY City resident.", "Julia Louis-Dreyfus", "http://www.studiosystemnews.com/wp-content/uploads/2013/08/julia-louis-dreyfus-black-e1376677080183.jpg"),
                new TVCharacter(3, "Kevin", "A boy growing up in the 60s and 70s.", "Fred Savage", "http://img4.wikia.nocookie.net/__cb20111002203900/itsalwayssunny/images/3/32/Fred_Savage.jpg"),
                new TVCharacter(3, "Winnie", "A girl growing up in the 60s and 70s", "Danica McKeller", "http://www.hairstylepedia.com/images/02/Danica-Mckellar-with-short-straight-hair.jpg")
                );

            db.SaveChanges();

            //Seed actors
            db.TVActors.AddOrUpdate(
                x => x.Name,
                new TVActor("Zooey Deschanel", "http://sizzlingsuperstars.com/wp-content/uploads/2014/04/Zooey-Deschanel-5.jpg"),
                new TVActor("Jerry Seinfeld", "http://blog.kevineikenberry.com/wp-content/uploads/2013/10/seinfeld_jerry.jpg")
                );

            db.SaveChanges();

            //Seed Actor/Character many to many table

            db.TVActorTVCharacters.AddOrUpdate(
                x => new { x.TVActorId, x.TVCharacterId },
                new TVActorTVCharacter(1, 1),
                new TVActorTVCharacter(2, 3)
                );

            db.SaveChanges();

        }

    }
}
